package Impl;

import Services.BlocService;

public class Bloc implements BlocService {
	private Type type;
	private Type oldType;
	
	public Bloc(){}
	
	@Override
	public void init(Type type){
		// mise a jour des types
		this.type = type;
		this.oldType = Type.Vide;
	}
	
	@Override
	public Type getType() {
		return type;
	}

	@Override
	public Type getOldType() {
		return oldType;
	}

	@Override
	public void ChangeType(Type type) {
		this.oldType = this.type;
		this.type = type;
	}
	
	@Override
	public boolean equals(Object blocold){
		if(!(blocold instanceof BlocService))
			return false;
		BlocService bloc = (BlocService) blocold;
		return ((type==bloc.getType()) && (oldType==bloc.getOldType()));
	}
	
	@Override
	public void clone(BlocService bloc){
		this.init(bloc.getOldType());
		this.ChangeType(bloc.getType());
	}
	
}
